<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../../print.css" type="text/css" media="print">
<meta content="State,com.flashsim.FStEng.Three.State,ENTRY,LEAVE,_se,handledEvYet,id,myStMgr,name,pulseActivities,transitions,addPulseActivity,addTransitionExternal,addTransitionToHistory,addTransitionToSelf,addTransitionToTarget,chgSt,enter,isActive,isSubstate,leave,onEvent,registerSubStates,removePulseActivity,removeState,removeTransition,resetHistory" name="keywords">
<title>com.flashsim.FStEng.Three.State</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'State - API Documentation';
				var baseRef = '../../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">Flash State Engine, version 3.0</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../index-list.html')" href="../../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../../index.html?com/flashsim/FStEng/Three/State.html&amp;com/flashsim/FStEng/Three/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;State</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a>&nbsp;| <a href="#constantSummary">Constants</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class State"); titleBar_setSubNav(true,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">com.flashsim.FStEng.Three</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class State</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">State <img class="inheritArrow" alt="Inheritance" title="Inheritance" src="../../../../images/inherit-arrow.gif"> flash.events.EventDispatcher</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Subclasses</td><td><a href="../Three/HStateC.html">HStateC</a></td>
</tr>
</table>
<p></p>
    A finite state, or a simple, non-hierarchical state.
    <p>State's are atomic, unlike HState's or HStateC's.  HStateC is a subclass of State, and HState is a subclass of HStateC.
    In technical terms, one could think about states by the number of state managers each has -- the State has none, an HState has
    one, and an HStateC has more than one.  Therefore, while it would be possible to collapse the definition of state to a single
    class, we define three separate classes because we feel it is easier to explain the theory of hierarchical states if there are three
    state concepts, even if technically they all could be implemented in a single class.
    
    <p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#handledEvYet">handledEvYet</a> : Boolean<div class="summaryTableDescription">
   Boolean flag used to determine if the State has handled the current event.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#id">id</a> : String<div class="summaryTableDescription">
   String identifier for the state.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#myStMgr">myStMgr</a> : <a href="../Three/StateManager.html">StateManager</a>
<div class="summaryTableDescription">
   Pointer to this State's State Manager instance.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#name">name</a> : String<div class="summaryTableDescription">
   An optional name for the State to give to the State Manager, used for display purposes only.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#pulseActivities">pulseActivities</a> : Array<div class="summaryTableDescription">
   An array containing the pulse activities (<code>PulseActivity</code>) for this state.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#_se">_se</a> : <a href="../Three/StateEngine.html">StateEngine</a>
<div class="summaryTableDescription">
   Pointer to the State Engine instance.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#transitions">transitions</a> : Object<div class="summaryTableDescription">
   An Object, keyed by target state id, that contains all the transitions for this State.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#State()">State</a>(identifier:String, msm:<a href="StateManager.html">StateManager</a> = null, nm:String = null)</div>
<div class="summaryTableDescription">
  The constructor for the state class.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addPulseActivity()">addPulseActivity</a>(intvl:uint, cb:Function, fb:Boolean = false):<a href="../Three/PulseActivity.html">PulseActivity</a>
</div>
<div class="summaryTableDescription">
  Use this method to add an activity to the state that fires at a specified interval.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addTransitionExternal()">addTransitionExternal</a>(tEvtName:String, targetStateID:String, transFn:Function = null, ulfxt:uint = 1):<a href="../Three/Transition.html">Transition</a>
</div>
<div class="summaryTableDescription">
   Add an 'external' transition, i.e., from this State to a target state.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addTransitionToHistory()">addTransitionToHistory</a>(tEvtName:String, targetStateID:String, transFn:Function = null):<a href="../Three/Transition.html">Transition</a>
</div>
<div class="summaryTableDescription">
   Add a transition from the current state to the history pseudo-state of a state.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addTransitionToSelf()">addTransitionToSelf</a>(tEvtName:String, transFn:Function = null, ulfst:int = 0):<a href="../Three/Transition.html">Transition</a>
</div>
<div class="summaryTableDescription">
   Add a transition from this State to itself, specifying parents to exit and re-enter.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addTransitionToTarget()">addTransitionToTarget</a>(tEvtName:String, targetStateID:String, transFn:Function = null):<a href="../Three/Transition.html">Transition</a>
</div>
<div class="summaryTableDescription">
   Add a transition from this State to a target state other than history.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#chgSt()">chgSt</a>(trans:<a href="Transition.html">Transition</a>, val:* = null):void</div>
<div class="summaryTableDescription">
  <p>Change state using transition trans_i, with an optional value for the
  transition function as a second argument.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#enter()">enter</a>(hist:Boolean = false, specIDs:Array = null):void</div>
<div class="summaryTableDescription">
  Called when the state is entered.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#isActive()">isActive</a>():Boolean</div>
<div class="summaryTableDescription">
  convenience function.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#isSubstate()">isSubstate</a>(st:<a href="State.html">State</a>):Boolean</div>
<div class="summaryTableDescription">
   isSubstate allows the caller to ask if a state is a substate of the state being called.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#leave()">leave</a>():void</div>
<div class="summaryTableDescription">
  Called when the state is exited (deactivated).</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#onEvent()">onEvent</a>(ev:Event, handledYet:Boolean):Boolean</div>
<div class="summaryTableDescription">
  <p>This is a new feature of FStEng v1.5, which provides an easy way to direct and process
  events.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#registerSubStates()">registerSubStates</a>(stateEng:<a href="StateEngine.html">StateEngine</a>):void</div>
<div class="summaryTableDescription">
  Goes through substates to register them with the state engine.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#removePulseActivity()">removePulseActivity</a>(pa:<a href="PulseActivity.html">PulseActivity</a>):void</div>
<div class="summaryTableDescription">
  Removes the specified pulse activity from the state.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#removeState()">removeState</a>():void</div>
<div class="summaryTableDescription">
   Deletes memory associated with this state.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#removeTransition()">removeTransition</a>(trans:<a href="Transition.html">Transition</a>):void</div>
<div class="summaryTableDescription">
   Remove the given transition from this State.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#resetHistory()">resetHistory</a>():void</div>
<div class="summaryTableDescription"></div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
</table>
</div>
<a name="constantSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Constants</div>
<table id="summaryTableConstant" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Constant</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#ENTRY">ENTRY</a> : String = "ENTRY"<div class="summaryTableDescription">[static]
   Event generated on entry to a state.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#LEAVE">LEAVE</a> : String = "LEAVE"<div class="summaryTableDescription">[static]
   Event generated when the state is no longer active.</div>
</td><td class="summaryTableOwnerCol">State</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="handledEvYet"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">handledEvYet</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>public var handledEvYet:Boolean</code><p>
   Boolean flag used to determine if the State has handled the current event.  It is reset to <code>false</code> when the State
   has a chance to handle a given event.  Developers will rarely (if ever) use this.
   </p></div>
<a name="id"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">id</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var id:String</code><p>
   String identifier for the state.  Must be unique in the entire state network.
   </p></div>
<a name="myStMgr"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">myStMgr</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var myStMgr:<a href="../Three/StateManager.html">StateManager</a></code><p>
   Pointer to this State's State Manager instance.
   </p></div>
<a name="name"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">name</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var name:String</code><p>
   An optional name for the State to give to the State Manager, used for display purposes only. If no
   name is set, we use id by default.
   </p></div>
<a name="pulseActivities"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">pulseActivities</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var pulseActivities:Array</code><p>
   An array containing the pulse activities (<code>PulseActivity</code>) for this state.
   </p></div>
<a name="_se"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">_se</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var _se:<a href="../Three/StateEngine.html">StateEngine</a></code><p>
   Pointer to the State Engine instance.  This is set at the time the engine is first activate, or, if the
   developer does not want to delay at that point, the developer can call <code>prepareNetwork()</code> once.
   </p></div>
<a name="transitions"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">transitions</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var transitions:Object</code><p>
   An Object, keyed by target state id, that contains all the transitions for this State.
   </p><p>The value of transitions is itself an array of transitions, because it's possible to have multiple transitions
   with the same target state (though they must have different event types).</p>
   </div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="State()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">State</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function State(identifier:String, msm:<a href="StateManager.html">StateManager</a> = null, nm:String = null)</code><p>
  The constructor for the state class.  Pass in a name, an ID (typically numeric),
  and a pointer to the state network manager.  If this state is the topmost in the
  whole network, the manager is <code>null</code>.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">identifier</span>:String</code> &mdash;  State identifier (id).  Must be unique among all states in the state engine.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">msm</span>:<a href="StateManager.html">StateManager</a></code> (default = <code>null</code>)<code></code> &mdash;    Pointer to a state manager, or null if this state is topmost
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">nm</span>:String</code> (default = <code>null</code>)<code></code> &mdash;    Display name of the State.  If null (not supplied), routines use the id for the display name.
  </td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="addPulseActivity()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addPulseActivity</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function addPulseActivity(intvl:uint, cb:Function, fb:Boolean = false):<a href="../Three/PulseActivity.html">PulseActivity</a></code><p>
  Use this method to add an activity to the state that fires at a specified interval.  You
  can specify a function or method to call. Note: if you need to refer to the timeline
  from within a function, use the last example to call your function.
  
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">intvl</span>:uint</code> &mdash; Interval, in milliseconds, between calls
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">cb</span>:Function</code> &mdash; Function or method to invoke
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">fb</span>:Boolean</code> (default = <code>false</code>)<code></code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../Three/PulseActivity.html">PulseActivity</a></code></td>
</tr>
</table>
<br>
<span class="label">Example</span>
<br>  // For a function: myFunc
  myState.addPulseActivity(0, 500, myFunc);
  // For a method: myObj.myMethod
  myState.addPulseActivity(0, 500, myObj.myMethod); 
 
  <p></p>
</div>
<a name="addTransitionExternal()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addTransitionExternal</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function addTransitionExternal(tEvtName:String, targetStateID:String, transFn:Function = null, ulfxt:uint = 1):<a href="../Three/Transition.html">Transition</a></code><p>
   Add an 'external' transition, i.e., from this State to a target state.
   </p><p>Use this method to transition out of the current state, up any number of parent state levels, then re-enter the path down towards the current state.  The
   difference between this method and <code>addTransitionToTarget()</code> is that the latter does not give the developer the ability to leave parent states of
   the target and return to the target, but this method does.  This method would be used in the following situation.  The source is a descendent of the target
   state.  The source wants to transition to the target state, leave the parent of the target state, and then re-enter the parent of the target state and finally
   go to the target state.  This would be accomplished by giving a final parameter value of 1 (up 1 level above the target).  If ulfxt == 0, this method is
   equivalent to <code>addTransitionToTarget()</code>.</p>
   <p>If the developer wants
   to manually code the event handler, then the developer uses <code>chgSt()</code> to fire
   this transition when it is triggered (just remember to hold onto the transition instance, which is the return value of this method).</p>
   <p>By default, when the developer creates a transition with this method, the actual determination of transition path (through which nodes,
   up/down how many levels, etc.) is postponed until the first activation of the State Engine.  This avoids the problem of defining a transition
   to a state that does not exist yet, for example, when two states have reciprocal transitions.  However, if the developer has activated the
   state engine already, or called the state engine's <code>prepareNetwork()</code>, he can add a transition and have its path resolved
   immediately by first calling <code>transPtr = addTransition()</code>, then, calling <code>transPtr.determineTransition()</code>.</p>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">tEvtName</span>:String</code> &mdash;    Name of the event that triggers the transition (if null, then transition must be manually triggered with <State>.chgSt())
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">targetStateID</span>:String</code> &mdash;  id of the target state
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">transFn</span>:Function</code> (default = <code>null</code>)<code></code> &mdash;    An optional function to execute when the transition is fired
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">ulfxt</span>:uint</code> (default = <code>1</code>)<code></code> &mdash;    (abbrev. "up levels for external transition") For an external transition, this value says how many levels to go up before re-entering that topmost state.  The developer uses this to determine how many states to exit and re-enter.
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../Three/Transition.html">Transition</a></code></td>
</tr>
</table>
</div>
<a name="addTransitionToHistory()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addTransitionToHistory</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function addTransitionToHistory(tEvtName:String, targetStateID:String, transFn:Function = null):<a href="../Three/Transition.html">Transition</a></code><p>
   Add a transition from the current state to the history pseudo-state of a state.
   </p><p>The history pseudo-state is an automatic element part of an HState or HStateC.  Conceptually, a transition to history makes the
   current state the last state visited in that state network.  Therefore, you specify the target state that <i>contains</i> the history
   state.  For example, if you have three states in the same network, A, B, and C, and A is current but C was the last state visited,
   you could add a transition from A -> history, and when that was triggered, the state engine would leave A and enter C.</p>
   <p>If the developer wants
   to manually code the event handler, then the developer uses <code>chgSt()</code> to fire
   this transition when it is triggered (just remember to hold onto the transition instance, which is the return value of this method).</p>
   <p>By default, when the developer creates a transition with this method, the actual determination of transition path (through which nodes,
   up/down how many levels, etc.) is postponed until the first activation of the State Engine.  This avoids the problem of defining a transition
   to a state that does not exist yet, for example, when two states have reciprocal transitions.  However, if the developer has activated the
   state engine already, or called the state engine's <code>prepareNetwork()</code>, he can add a transition and have its path resolved
   immediately by first calling <code>transPtr = addTransition()</code>, then, calling <code>transPtr.determineTransition()</code>.</p>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">tEvtName</span>:String</code> &mdash;    Name of the event that triggers the transition (if null, then transition must be manually triggered with <State>.chgSt())
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">targetStateID</span>:String</code> &mdash;  id of the target state
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">transFn</span>:Function</code> (default = <code>null</code>)<code></code> &mdash;    An optional function to execute when the transition is fired
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../Three/Transition.html">Transition</a></code></td>
</tr>
</table>
</div>
<a name="addTransitionToSelf()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addTransitionToSelf</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function addTransitionToSelf(tEvtName:String, transFn:Function = null, ulfst:int = 0):<a href="../Three/Transition.html">Transition</a></code><p>
   Add a transition from this State to itself, specifying parents to exit and re-enter.
   </p><p>Use this method to transition out of the current state, up any number of parent state levels, then re-enter the state.</p>
   <p>If the developer wants
   to manually code the event handler, then the developer uses <code>chgSt()</code> to fire
   this transition when it is triggered (just remember to hold onto the transition instance, which is the return value of this method).</p>
   <p>By default, when the developer creates a transition with this method, the actual determination of transition path (through which nodes,
   up/down how many levels, etc.) is postponed until the first activation of the State Engine.  This avoids the problem of defining a transition
   to a state that does not exist yet, for example, when two states have reciprocal transitions.  However, if the developer has activated the
   state engine already, or called the state engine's <code>prepareNetwork()</code>, he can add a transition and have its path resolved
   immediately by first calling <code>transPtr = addTransition()</code>, then, calling <code>transPtr.determineTransition()</code>.</p>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">tEvtName</span>:String</code> &mdash;    Name of the event that triggers the transition (if null, then transition must be manually triggered with <State>.chgSt())
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">transFn</span>:Function</code> (default = <code>null</code>)<code></code> &mdash;    An optional function to execute when the transition is fired
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">ulfst</span>:int</code> (default = <code>0</code>)<code></code> &mdash;    (abbrev. "up levels for self transition") For a transition to self, this value says how many levels to go up before coming back down.  The developer uses this to determine how many states to exit and re-enter.
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../Three/Transition.html">Transition</a></code></td>
</tr>
</table>
</div>
<a name="addTransitionToTarget()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addTransitionToTarget</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function addTransitionToTarget(tEvtName:String, targetStateID:String, transFn:Function = null):<a href="../Three/Transition.html">Transition</a></code><p>
   Add a transition from this State to a target state other than history.
   </p><p>Use this method to define a transition from one State to another.  If the target state is the same as the source, this method
   exits the source and re-enters it.  If the developer wants to exit parent states, use <code>addTransitionToSelf</code> which allows
   the developer to specify exactly how many levels to exit and re-enter.</p>
   <p>To transition to the history pseudo-state, use <code>addTransitionToHistory</code>.</p>
   <p>If the developer wants
   to manually code the event handler, then the developer uses <code>chgSt()</code> to fire
   this transition when it is triggered (just remember to hold onto the transition instance, which is the return value of this method).</p>
   <p>By default, when the developer creates a transition with this method, the actual determination of transition path (through which nodes,
   up/down how many levels, etc.) is postponed until the first activation of the State Engine.  This avoids the problem of defining a transition
   to a state that does not exist yet, for example, when two states have reciprocal transitions.  However, if the developer has activated the
   state engine already, or called the state engine's <code>prepareNetwork()</code>, he can add a transition and have its path resolved
   immediately by first calling <code>transPtr = addTransition()</code>, then, calling <code>transPtr.determineTransition()</code>.</p>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">tEvtName</span>:String</code> &mdash;    Name of the event that triggers the transition (if null, then transition must be manually triggered with <State>.chgSt())
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">targetStateID</span>:String</code> &mdash;  id of the target state
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">transFn</span>:Function</code> (default = <code>null</code>)<code></code> &mdash;    An optional function to execute when the transition is fired
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../Three/Transition.html">Transition</a></code></td>
</tr>
</table>
</div>
<a name="chgSt()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">chgSt</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function chgSt(trans:<a href="Transition.html">Transition</a>, val:* = null):void</code><p>
  </p><p>Change state using transition trans_i, with an optional value for the
  transition function as a second argument.
  If you look at the code, this function passes the information
  to the chgSt method of the state manager to do the real work.  The reason we define
  this dummy is so that modelers see the direct relationship to the transition id,
  which is unique by state.  For example, if a caller wants to change the current state,
  state 2, using transition 0, the caller would write:</p>
  <code>state2.chgSt(0);</code>
  <p>This implies that the transition 0 is relative to the state.  The same unaltered call
  would be</p>
  <code>sm.chgSt(0);</code>
  <p>in which 'sm' is the state manager of state 2 and its siblings.  It is less obvious from the
  second form that the processor is using the current state (2)'s transition 0, as opposed
  to, perhaps, state 1 or 6's transition with id 0.</p>
  <p>The second argument, val, is an optional value to send in to the transition function.</p>
  <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">trans</span>:<a href="Transition.html">Transition</a></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">val</span>:*</code> (default = <code>null</code>)<code></code></td>
</tr>
</table>
</div>
<a name="enter()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">enter</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function enter(hist:Boolean = false, specIDs:Array = null):void</code><p>
  Called when the state is entered.  This is a private routine and should not be
  overriden by developers.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">hist</span>:Boolean</code> (default = <code>false</code>)<code></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">specIDs</span>:Array</code> (default = <code>null</code>)<code></code></td>
</tr>
</table>
</div>
<a name="isActive()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">isActive</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function isActive():Boolean</code><p>
  convenience function.  Returns true if this state is currently active,
  false if not.
  </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code> &mdash; True if the state is active, false if not.
  </td>
</tr>
</table>
</div>
<a name="isSubstate()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">isSubstate</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function isSubstate(st:<a href="State.html">State</a>):Boolean</code><p>
   isSubstate allows the caller to ask if a state is a substate of the state being called. It returns true if it
   is a substate, false if it is not.  For simple states, it always returns false since there are no substates.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">st</span>:<a href="State.html">State</a></code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="leave()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">leave</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function leave():void</code><p>
  Called when the state is exited (deactivated).  This is a private routine and should not be
  overriden by developers.
  </p></div>
<a name="onEvent()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">onEvent</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function onEvent(ev:Event, handledYet:Boolean):Boolean</code><p>
  </p><p>This is a new feature of FStEng v1.5, which provides an easy way to direct and process
  events.  Rather than having the developer provide an <code>ieh()</code> method, which
  determines the current state and which transitions or actions should be triggered, the
  new mechanism automatically routes the event to the most specific (deepest in network) active state's
  <code>onEvent</code> handler.  The handler, by default, looks through the triggers of
  the transitions and internal actions on the state.  If a trigger is true, it then fires
  the transition or action.  The default routine passes the event to the state's parent
  to check its transitions and actions as well.  If a transition gets fired, then parent
  states do not evaluate their transitions, but still evaluate their internal action
  triggers.</p>
  <p>This extra processing can add time because all triggers are checked in the chain of
  active states, regardless of their chance of success.  The beauty of this system is that
  if a state wants to optimize event handling for itself
  and its sub-networks, it merely needs to override <code>onEvent</code> and follow the
  rules about passing up the event once finished.  If you really need to optimize the
  event handling, you can still override <code>ieh()</code> and bypass this feature
  completely, and do it as described in our book.</p>
  <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">ev</span>:Event</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">handledYet</span>:Boolean</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
<br>
<span class="label">Events</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><b>onEvent
</b></code></td>
</tr>
</table>
</div>
<a name="registerSubStates()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">registerSubStates</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function registerSubStates(stateEng:<a href="StateEngine.html">StateEngine</a>):void</code><p>
  Goes through substates to register them with the state engine.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">stateEng</span>:<a href="StateEngine.html">StateEngine</a></code></td>
</tr>
</table>
</div>
<a name="removePulseActivity()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">removePulseActivity</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function removePulseActivity(pa:<a href="PulseActivity.html">PulseActivity</a>):void</code><p>
  Removes the specified pulse activity from the state.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">pa</span>:<a href="PulseActivity.html">PulseActivity</a></code> &mdash; ID of the activity
  </td>
</tr>
</table>
</div>
<a name="removeState()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">removeState</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function removeState():void</code><p>
   Deletes memory associated with this state.
   </p></div>
<a name="removeTransition()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">removeTransition</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function removeTransition(trans:<a href="Transition.html">Transition</a>):void</code><p>
   Remove the given transition from this State.
   </p><p>Unhook the given transition from the source state.</p>
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">trans</span>:<a href="Transition.html">Transition</a></code> &mdash; Transition instance to remove from source state.
   </td>
</tr>
</table>
</div>
<a name="resetHistory()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">resetHistory</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function resetHistory():void</code>
</div>
<a name="constantDetail"></a>
<div class="detailSectionHeader">Constant detail</div>
<a name="ENTRY"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">ENTRY</td><td class="detailHeaderType">constant</td>
</tr>
</table>
<div class="detailBody">
<code>public static const ENTRY:String = "ENTRY"</code><p>
   Event generated on entry to a state.
   </p><p>Listeners will be notified when the state becomes active (is entered).</p>
   </div>
<a name="LEAVE"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">LEAVE</td><td class="detailHeaderType">constant</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static const LEAVE:String = "LEAVE"</code><p>
   Event generated when the state is no longer active.
   </p><p>Listeners will be notified when the state is no longer an active state.</p>
   </div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
